<?php

namespace Upfor\UpforPHP\Interfaces;

interface ViewInterface {

    /**
     * Return view data value with key
     *
     * @param  string $key
     * @return mixed
     */
    public function get($key);

    /**
     * Set view data value with key
     *
     * @param string $key
     * @param mixed  $value
     */
    public function set($key, $value);

    /**
     * Replace view data
     *
     * @param  array $data
     */
    public function replace(array $data);

    /**
     * Return view data
     *
     * @return array
     */
    public function all();

    /**
     * Clear view data
     */
    public function clear();

    /**
     * Set the base directory that contains view templates
     *
     * @param  string $directory
     */
    public function setTemplatesDirectory($directory);

    /**
     * Get templates base directory
     *
     * @return string
     */
    public function getTemplatesDirectory();

    /**
     * Get fully qualified path to template file using templates base directory
     *
     * @param  string $file The template file pathname relative to templates base directory
     * @return string
     */
    public function getTemplatePathname($file);

    /**
     * Display template
     *
     * @param  string $template Pathname of template file relative to templates directory
     * @param  array  $data     Any additional data to be passed to the template.
     */
    public function display($template, array $data = array());

    /**
     * Return the contents of a rendered template file
     *
     * @param  string $template The template pathname, relative to the template base directory
     * @return string           The rendered template
     */
    public function fetch($template);

}
